
/*
 * @Author       : 吴豪
 * @Date         : 2021-12-4 15:56:22
 * @FilePath     : \book-manage-front\src\services\login.ts
 * @Description  : 登录页面接口文件
 */

import type { LoginParamsType } from '@/dataType';
import { request } from 'umi';

/**
 * 1.获取图形验证码
 * @returns 
 */
export async function getImageCode() {
  return request<{ imageCodeKey: string; imageCodeBase64: string }>('/loginManage/getImageCode', {});
}

/**
 * 2.用户登录
 * @param params 
 * @returns 
 */
export async function userLogin(params: LoginParamsType) {
  console.log('params:', params);

  return request<{ token: string; }>('/loginManage/userLogin', {
    data: params,
    method: 'POST'
  });
}

/**
 * 3.获取当前登录用户的姓名
 * @returns 
 */
export async function getPresentUsername() {
  return request<{ name: string }>('/loginManage/getPresentUsername', {})
}

